/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DSB.Model.Kaart;

import DSB.Model.Kaart.Enums.CoordinateDirection;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;

/**
 *
 * @author Gebruiker
 */
public class POI extends MapDecorator {
    
    private BufferedImage _poiImage;

    private Map _map;
    private Coordinaat _coordinaat;
    private int _straal;
    private String _name;
    
    
    /**
     *
     * @param map
     * @param coordinaat
     * @param straal
     * @param name
     */
    public POI(Map map, Coordinaat coordinaat, int straal, String name)
    {
        _map = map;
        _coordinaat = coordinaat;
        _straal = straal;
        _name = name;
        try {
            _poiImage = ImageIO.read(new File("Resources/images/poi.png"));
        } catch (Exception e) {
        }
    }

    /**
     *
     * @return
     * Tekenen van de poi op de map
     */
    @Override
    public BufferedImage DrawOnMap() {
        BufferedImage newImage = _map.DrawOnMap();
        BufferedImage combined = new BufferedImage(newImage.getWidth(), newImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
        
        Graphics2D g2d = combined.createGraphics();
        g2d.drawImage(newImage, 0, 0, null);
        int convlon = ConvertCoordinate(_coordinaat.getLongitude(), CoordinateDirection.HORIZONTAL);
        int convlat = ConvertCoordinate(_coordinaat.getLatitude(), CoordinateDirection.VERTICAL);
        g2d.drawImage(_poiImage, convlon - 16, convlat - 51,null);
        
        g2d.setStroke(new BasicStroke(1));
        g2d.setColor(Color.decode("#646473"));
        
        Shape radius = new Ellipse2D.Double(convlon - _straal, convlat - _straal, 2.0 * _straal, 2.0 * _straal);      
        g2d.draw(radius);
        
        return combined;
    }
}
